<ui:composition template="/templates/layout.xhtml" 
	xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:fmt="http://java.sun.com/jstl/fmt"
    xmlns:x="http://java.sun.com/jstl/xml"
    xmlns:fn="http://java.sun.com/jstl/functions"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:gape="http://componentes.gape/component/gape">
    
	<ui:define name="titulo">
		<h:outputText value="#{msg.applicationName} - #{msg.titleTelaInsertOrganization}" />
	</ui:define>

	<ui:define name="menu">
		<c:choose>
			<c:when test="${strategy.strategyChosen}">
				<ui:include src="/menu/menuStrategicPlan.xhtml" />					
			</c:when>						
		</c:choose>		
	</ui:define>
	
	<ui:define name="conteudo">
		<h:panelGrid columns="2" footerClass="FormLinhaBotoes" headerClass="pathway" columnClasses="label,field">
 				<h:outputText value="#{msg.nameLabel}" />
 				<h:inputText id="name" value="#{organization.nome}" size="100"/>
 				
 				<h:outputText value="#{msg.missionLabel}" />
 				<h:inputTextarea rows="3" cols="30" value="#{organization.missao}"/>
 				
 				<h:outputText value="#{msg.visionLabel}" />
 				<h:inputTextarea rows="3" cols="30" value="#{organization.visao}"/>
 				
 				<h:outputText value="#{msg.adminUserLabel}" />
 				<h:selectOneMenu value="#{organization.admin}">
						<f:selectItems value="#{organization.listUsers}" />
			</h:selectOneMenu>
			
		</h:panelGrid>
		 	  					  				
		<h:panelGrid columns="2" footerClass="FormLinhaBotoes" headerClass="pathway" columnClasses="label,field">				
			<rich:scrollableDataTable height="200px" width="600px" id="values" rowClasses="odd,even" value="#{organization.listValues}" 
								      var="row" rowKeyVar="linha" selectionMode="multi" selection="#{organization.selection}">
				<f:facet name="header">
					<h:outputText value="#{msg.organizationTitleValuesGrid}" styleClass="pathway"/>
				</f:facet>
				
				<rich:column width="40px">
					<f:facet name="header">
						<h:outputText value="#{msg.positionTitleColumn}" />
					</f:facet>
					
					<h:outputText value="#{row.position}" />
				</rich:column>
									  										  
				<rich:column width="500px">
					<f:facet name="header">
						<h:outputText value="#{msg.valuesTitleColumn}" />
					</f:facet>				
				
					<h:outputText value="#{row.value}"/>
				</rich:column>
				
				<rich:column width="40px">
					<f:facet name="header">
						<h:outputText value="#{msg.actionsTitleColumn}" />
					</f:facet>				
				
	            	<a4j:commandLink id="delete" action="#{organization.deleteValue}" reRender="values" styleClass="imageLink">
                    	<h:graphicImage value="/files/delete.png" style="border:0" />
                        <f:setPropertyActionListener value="#{linha}" target="#{organization.valorSelecionado}" />
                    </a4j:commandLink>
                    <rich:toolTip for="delete" value="#{msg.buttonDelete}" />		                    
            	</rich:column>
			</rich:scrollableDataTable>
			
			<h:panelGrid columns="1">
				<a4j:commandButton action="#{organization.upValue}" reRender="values" image="/files/arrow-up.png"/>
				<a4j:commandButton action="#{organization.downValue}" reRender="values" image="/files/arrow-down.png"/>
			</h:panelGrid>
		</h:panelGrid>
		
		<h:panelGrid columns="1">						
			<rich:messages layout="list" style="color: Red; align: Center; font-size: 15px"/>						
		</h:panelGrid>
	</ui:define>	

	<ui:define name="menuTela">
		<ui:include src="menu.xhtml" />
	</ui:define>

	<ui:define name="menuNavegacaoBack">
		<gape:navigationBack action="#{organization.back}"/>
	</ui:define>

	<ui:define name="menuNavegacaoForward">
		<gape:navigationForward action="#" disabled="#{true}"/>
	</ui:define>

	<ui:define name="includePanels">
		<ui:include src="panelNewValue.xhtml" />
	</ui:define>
</ui:composition>